import { ShareModule } from './share/share.module';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { CoreModule } from '@core/core.module';
import { AppRoutingModule } from './app-routing.module';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';

/** 配置 ng-zorro-antd 国际化 **/
import { NZ_I18N, zh_CN } from 'ng-zorro-antd/i18n';
import { NzConfig, NZ_CONFIG } from 'ng-zorro-antd/core/config';
import { PageModule } from './view/page/page.module';
registerLocaleData(zh);


const ngZorroConfig: NzConfig = {
	// 注意组件名称没有 nz 前缀
	message: { nzDuration: 5000 },
	pagination: {
		nzPageSizeOptions: [10, 30, 50, 70]
	},
	select:{
		nzBackdrop:true
	},
	treeSelect:{
		nzBackdrop:true
	},
	cascader:{
		nzBackdrop:true
	},
	datePicker: {
		nzBackdrop:true
	},
	modal:{
		nzMaskClosable: false
	}
};

@NgModule({
	declarations: [
		AppComponent
	],
	imports: [
		BrowserModule,
		BrowserAnimationsModule,
		CoreModule,
		AppRoutingModule,
		ShareModule,
		PageModule,
		/* 默认打包环境为prod时注册ServiceWorker,如不需要可以注释掉,相关配置可以参考英文官网 */
		environment.env === 'prod' ? ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production }) : [],
	],
	providers: [
		{ provide: NZ_I18N, useValue: zh_CN },
		{ provide: NZ_CONFIG, useValue: ngZorroConfig }
	],
	bootstrap: [AppComponent]
})
export class AppModule { }
